]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Cancel Destroy effect of modal windows when the parent has gone away
authorMaxim Ermilov <zaspire@rambler.ru>
Wed, 15 Sep 2010 11:52:20 +0000 (15:52 +0400)
committerMaxim Ermilov <zaspire@rambler.ru>
Wed, 15 Sep 2010 11:55:33 +0000 (15:55 +0400)
Modal dialogs slide back into the titlebar of the parent window when destroyed.
This looks weird if the parent window itself has been destroyed, so cancel the
effect in this case.
https://bugzilla.gnome.org/show_bug.cgi?id=629560

js/ui/windowManager.js

index d6945537b07a3f2ac1351182ec2b53875a45fc63..da77c10a0370dd872c9a41b9978d3d4319e4934b 100644 (file)
@@ -334,15 +334,10 @@ WindowManager.prototype = {
         }
     },
 
-    _destroyWindowOverwrite : function(shellwm, actor) {
-        if (this._removeEffect(this._mapping, actor)) {
-            shellwm.completed_destroy(actor);
-        }
-    },
-
-     _destroyWindow : function(shellwm, actor) {
+    _destroyWindow : function(shellwm, actor) {
+        let parent = actor.get_meta_window().get_transient_for();
         while (actor.get_window_type() == Meta.CompWindowType.MODAL_DIALOG
-               && actor.get_meta_window().get_transient_for()) {
+               && parent) {
             if (!Main.overview.visible)
                 this._undimParentWindow(actor, true);
             this._dimmedWindows = this._dimmedWindows.filter(function(win) {
@@ -353,7 +348,12 @@ WindowManager.prototype = {
                 break;
             actor.set_scale(1.0, 1.0);
             actor.show();
-            this._mapping.push(actor);
+            this._destroying.push(actor);
+
+            actor._parentDestroyId = parent.connect('unmanaged', Lang.bind(this, function () {
+                Tweener.removeTweens(actor);
+                this._destroyWindowDone(shellwm, actor);
+            }));
 
             Tweener.addTween(actor,
                              { scale_y: 0,
@@ -362,7 +362,7 @@ WindowManager.prototype = {
                                onComplete: this._destroyWindowDone,
                                onCompleteScope: this,
                                onCompleteParams: [shellwm, actor],
-                               onOverwrite: this._destroyWindowOverwrite,
+                               onOverwrite: this._destroyWindowDone,
                                onOverwriteScope: this,
                                onOverwriteParams: [shellwm, actor]
                              });
@@ -372,11 +372,13 @@ WindowManager.prototype = {
     },
 
     _destroyWindowDone : function(shellwm, actor) {
-        if (actor && actor.get_window_type() == Meta.CompWindowType.MODAL_DIALOG &&
-            actor.get_meta_window().get_transient_for()) {
-            if (this._removeEffect(this._mapping, actor)) {
-                shellwm.completed_destroy(actor);
+        if (this._removeEffect(this._destroying, actor)) {
+            let parent = actor.get_meta_window().get_transient_for();
+            if (parent && actor._parentDestroyId) {
+                parent.disconnect(actor._parentDestroyId);
+                actor._parentDestroyId = 0;
             }
+            shellwm.completed_destroy(actor);
         }
     },